const {body} = require('express-validator')
const validate = require('../middleware/validate')
const {isUrlValid} = require('../utils/utils')
exports.getArticleCollector = validate([
  body("url").notEmpty().withMessage("url不能为空"),
  body('url').custom(async (value) => {
    console.log('value:',value)
    console.log('isUrlValid(value):',isUrlValid(value))
    if (!isUrlValid(value)) {
      return Promise.reject('url地址不支持')
    }
    return true
  }),
]);
